package com.aispeech.task.api.data.enums;

import lombok.Getter;

public enum Errors {
    ERR_SYS_INTERNAL(100000, "系统异常"),
    ERR_CHECK_PARAM(100001, "参数校验失败"),
    ERR_MISS_PARAM(100002, "参数缺失"),
    ERR_AUTH_FAILED(100003, "Authentication Failed"),
    ERR_DEVICE_NOT_FOUND(100004, "device not found"),

    ERR_TASK_OVER_QUEUE(110001, "Over the limit of task queue size"),
    ERR_TASK_NOT_FINISHED(110002, "not finished"),
    ;
    @Getter
    private int errorCode;
    @Getter
    private String errorDesc;

    Errors(int errorCode, String errorDesc) {
        this.errorCode = errorCode;
        this.errorDesc = errorDesc;
    }

    public static String getDesc(int errorCode) {
        for (Errors bussErrorCode : Errors.values()) {
            if (bussErrorCode.getErrorCode() == errorCode) {
                return bussErrorCode.errorDesc;
            }
        }
        return errorCode + "";
    }

}
